<link rel="stylesheet" href="layui/css/layui.css">

<body class="childrenBody">

    <div style="padding: 15px;">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                     <input id="ID" name="ID" type="hidden" name="" value="">
                    <input id="Username" type="text" name="Username" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
			<div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-block">
              <input id="Password" type="text" name="Password" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
                  <div class="layui-form-item">
                <label class="layui-form-label">等级</label>
                <div class="layui-input-block">
                    <input id="Level" type="text" name="Level" lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
			
			
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" type="button" lay-submit="" lay-filter="add">立即修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script src="layui/layui.js"></script>
    <script>
              layui.use(['table', 'form'], function() {
            var table = layui.table;
            var form = layui.form;
            form.on('submit(add)', function(data) {
                var index = parent.layer.getFrameIndex(window.name);
                $.ajax({
                    url:'http://svcsa.org/Authorization/' + data.field.ID,
                    type : 'POST',
                    dataType : 'json',
                    data : {
                        Username: data.field.Username,
                        Password: data.field.Password,
                        Level: data.field.Level,
                    },
                    header:{
                        Accept:'application/json'
                    },
                    success:function(data){
                        layer.msg('修改成功', {
                            icon: 1,
                            time: 1500
                        }, function() {
                            parent.layer.close(index);
                        });
                    },
                    error:function(data){
                        console.log(data)
                    }
                });

            });
        });
    </script>

</body>